Skip to content

Conversation

@kderusso
Copy link
Member

This PR fixes an issue from #119967 where the default index_options were not displayed when include_defaults is set to true.

Part of this fix requires serializing the model_settings earlier so they're accessible when we're performing serialization checks for index_options.

Here is an example of how to test this:

PUT my-dense-semantic-index/
{
  "mappings": {
    "properties": {
      "inference_field": {
        "type": "semantic_text",
        "inference_id": "my-e5-model"
        }
      }
    }
  }
}

// Should not return index_options
GET my-dense-semantic-index/_mapping

// Returns BBQ hnsw default index_options
GET my-dense-semantic-index/_mapping/field/inference_field?include_defaults

@kderusso kderusso added v9.2.0 >bug :Search Relevance/Search Catch all for Search Relevance and removed v9.1.0 labels Jun 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @kderusso, I've created a changelog YAML for you.

@kderusso kderusso marked this pull request as ready for review June 25, 2025 12:44
@kderusso kderusso requested review from Mikep86 and jimczi June 25, 2025 12:44
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Jun 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@kderusso kderusso requested a review from a team June 25, 2025 19:07
Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach looks good overall, I have some follow-up questions about null serialization though.

@Mikep86
Copy link
Contributor

Mikep86 commented Jun 25, 2025

Also, can we add a test showing that index_options provided by the user are always serialized?

@kderusso
Copy link
Member Author

Also, can we add a test showing that index_options provided by the user are always serialized?

@Mikep86 Please see the tests starting here and let me know if you believe there's a gap.

@Mikep86
Copy link
Contributor

Mikep86 commented Jun 25, 2025

@kderusso This test doesn't cover what I had in mind. I think it would be good to check that if we provide a mapping like:

PUT my-index
{
  "mappings": {
    "properties": {
      "dense_inference": {
        "type": "semantic_text",
        "inference_id": "some_dense_inference_id",
        "index_options": {
          <BBQ index options that match defaults>
        }
      }
    }
  }
}

The index_options are always serialized, even though they match defaults, because they are user-provided. This behavior differs from other field types, so good to capture in a test.

@kderusso kderusso requested a review from Mikep86 June 26, 2025 12:29
Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the changes!

@kderusso kderusso merged commit 81a6ead into elastic:main Jun 26, 2025
32 checks passed
smalyshev pushed a commit to smalyshev/elasticsearch that referenced this pull request Jun 27, 2025
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Search Relevance/Search Catch all for Search Relevance Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants